package com.lcf.app.rabbitmq.consumer.listener;

import com.lcf.common.model.MqConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author ChenFei
 * @date 2021/12/2
 */
@Slf4j
@Component
public class TopicReceiverListener {

    /**
     * 这两个方法使用了相同的队列
     * <p>
     * 如果多个方法使用了相同的队列，则会轮训执行
     */

    @RabbitListener(queues = MqConstant.TOPIC_QUEUE)
    public void topicOne(String message) {
        log.info("topicOne : {}", message);
    }

    @RabbitListener(queues = MqConstant.TOPIC_QUEUE)
    public void topicTwo(String message) {
        log.info("topicTwo : {}", message);
    }

}
